package ua.pp.shell.wka;

public class Pager {
	public int page = 0;
	public int pages = 0;
	public int on_page = 20;
	public int count = 0;
	public int from = 0;
	
	public Pager() {
		
	}
	
	public void SetPage(int page) {
		if (page > pages - 1) {
			return ;
		}
		this.page = page;
		from = page * on_page;
	}
	
	//abstract
	public int GetCount() {
		return 0;
	}
	
	public Pager(int on_page) {
		this.on_page = on_page;
		Fill(count, on_page);
	}
	
	public Pager(int count, int on_page) {
		Fill(count, on_page);
	}
	
	public void Fill(int count, int on_page) {
		this.count = count;
		this.on_page = on_page; 
		this.pages = (int)Math.ceil((double)count/on_page);    		
	}
	
	public void ReFill() {
		count = this.GetCount(); 
		Fill(count, on_page);
	}
}
